package com.hjs.community.inform.Listener;


import com.hjs.community.inform.config.DelayedConfig;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.context.annotation.Configuration;

import java.util.Date;

/**
 * @className: RabbitListener
 * @author: shuishui
 * @date: 2023/03/08 17:15
 */
@Configuration
public class RabbitListener {
    @org.springframework.amqp.rabbit.annotation.RabbitListener(queues = DelayedConfig.YOUR_QUEUE_NAME)
    public void listener(String msg, Channel channel, Message message) throws Exception {
        System.out.println("消费数据:" + msg + ",时间:" + new Date());
        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
    }
}
